{% extends "../main.html" %}
{% block head_js %}
<link href="{{static_url('datatable/jquery.dataTables.css')}}" rel="stylesheet">
<!--link href="http://cdn.datatables.net/1.10.0/css/jquery.dataTables.css" rel="stylesheet"-->
<style type="text/css">
#red {color: red;}
#blue {color: blue;}
#orange {color: orange;}
#green {color: green;}
a {color: inherit;}


</style>
{% end %}
{% block nem %}
<ul class="nav nav-sidebar">
    <li class="active"><a href="/users">主机管理</a></li>
    <li><a href="/hosts/add">添加</a></li>
    <li><a href="/hosts/update">更新</a></li>

</ul>

{% end %}
{% block bodyy %}
<h3 class="sub-header" content="">主机列表</h3>
<form action="/hosts/update" method="get">
    <table id="hosts" class="table table-condensed">
        <thead>
        <tr>
            <th>ID</th>
            <th>主机IP</th>
            <th>主机组</th>
            <th>端口</th>
            <th>用户</th>
            <th>主机状态</th>
            <th>监控状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for i in data %}
        <tr>
            <td>{{i[0]}}</td>
            <td>{{i[1]}}</td>
            <td>{{i[2]}}</td>
            <td>{{i[3]}}</td>
            <td>{{i[4]}}</td>
            <td>{% if i[-2]==1 %}正常{% else %}停用{% end %}</td>
            <td>{% if i[-1]==1 %}开启监控{% else %}关闭监控{% end %}</td>
            <td>
                <button type="submit" class="btn btn-primary btn-xs" name="id" value={{i[0]}}>编辑</button>
                <a href="/delete/hosts/{{i[0]}}" class="btn btn-xs btn-danger">删除</a>
                <!--<span id="green"><a href="/hosts/update?hosts_length=10&id={{i[0]}}">编辑</a></span>-->
                <!--<span id="red"><a href="/delete/hosts/{{i[0]}}">删除</button></a></span>-->
            </td>
        </tr>
        {% end %}
        </tbody>
    </table>
</form>


{% end %}
{% block body_js %}
<script src="{{ static_url('datatable/jquery.dataTables.min.js') }}"></script>
<!--script src="https://cdn.datatables.net/1.10.8/js/jquery.dataTables.min.js"></script-->
<script type="text/javascript">
    $(document).ready(function () {
        $('#hosts').dataTable({
            "language": {
                "url": "{{ static_url('datatable/Chinese.json') }}"
            }
        });
    });
</script>
{% end %}
